function infolog (title = '提示信息',message = '未输入', type = 'info') {
    try {
        throw new Error()
    } catch (e: any) {
        let colors: any = {
            info: ['#909399', '#c9c9c9'],
            warn: ['rgb(230, 162, 60)', 'rgba(230, 162, 60, .5)'],
            primary: ['rgb(64, 158, 255)', 'rgba(64, 158, 255, .5)'],
            success: ['rgba(103, 194, 58)', 'rgba(103, 194, 58, .5)'],
            error: ['rgba(245, 108, 108)', 'rgba(245, 108, 108, .5)'],
            black: ['rgba(48, 49, 51)', 'rgba(48, 49, 51, .8)']
        }
        const stack = e.stack
        const stackLineArr = stack.split('\n')[2].split('(')
        let active = stackLineArr[0].split('.')[1]
        let paths = stackLineArr[1].split('?')
        let filePathArr = paths[0].split('/')
        let fileName = filePathArr[filePathArr.length-1]
        let hang = paths[1].split(':')[1]
        let messageinfo = `追踪信息：${fileName} -> ${active} -> ${hang}行`
        console.log(`%c ${title} %c ${message} %c ${messageinfo} %c`,
        `background:${colors[type][0]};border:1px solid ${colors[type][0]}; padding: 1px; border-radius: 2px 0 0 2px; color: #fff;`,
        `display:inline-block;border:1px solid ${colors[type][0]}; padding: 1px; color: ${colors[type][0]};`,
        `background:${colors[type][1]};border: 1px solid ${colors[type][1]}; padding: 1px; border-radius: 2px 0 0 2px; color: #fff;`,
        'background:transparent')
    }
}

// function infolog(message: string) {
//     try {
//       throw new Error();
//     } catch (e: any) {
//       console.log(e.stack);
//       const stack = e.stack;
//       const stackLines = stack.split('\n');
      
//       // 通常第一行是错误信息，第二行包含文件和行号
//       const fileAndLineNumber = stackLines[2];
  
//       // 使用正则表达式匹配文件名和行号
//       const matches = fileAndLineNumber.match(/(.*):(\d+):/);
//       if (matches) {
//         const fileName = matches[1];
//         const lineNumber = matches[2];
//         console.log(`文件名: ${fileName}, 行号: ${lineNumber}`);
//       } else {
//         console.error('无法从堆栈跟踪中提取文件名和行号。');
//       }
//     }
//   }

export {
    infolog
}